Overview
As mentioned in the core concepts, Sentiment v2 has a layered lending approach, which separates external lending actions (super pool interactions) and internal lending actions (base pool interactions). The expected behavior is for ordinary users and developers to interact solely with super pools. While interaction with base pools is permitted, it is not expected that most users and developers will interact with base pools for lending activities.
Creating a Super Pool
Anyone can create and manage Super Pools on Sentiment v2. The aim is to make creation and maintenance of Super Pools as frictionless as possible.
Super Pools are deployed via a Super Pool Factory.
function deploySuperPool(
address owner,
address asset,
address feeRecipient,
uint256 fee,
uint256 superPoolCap,
uint256 initialDepositAmt,
string calldata name,
string calldata symbol
) external returns (address) { }
An overview of the Super Pool creation params:
ownerThe address of the Super Pool adminassetThe erc20 asset that the Super Pool accepts as depositsfeeRecipientThe address to which fees generated from Super Pool will accrue tofeeThe performance fee taken from interest accrued to the super pool, given to thefeeRecipientsuperPoolCapThe maximum amount of assets that can be deposited in the SuperPoolinitialDepositAmtInitial amount of assets, deposited into the superpool and burnednamename of super poolsymbolsymbol of super pool. This will be used for LP tokens
Interacting with Super Pools
Admin functions
The creator of a Super Pool has privilege actions that help the admin manage assets, allocations and fees of a specific Super Pool.
Pool Management
Adding Pools
function addPool(uint256 poolId, uint256 assetCap) external onlyOwner{}
- Adds a base pool to which assets can be allocated to
| Parameters | type | Description |
|---|---|---|
poolId | uint | Id of the pool to add |
assetCap | uint | maximum amount of assets to allocate |
Removing Pools
function removePool(uint256 poolId, bool forceRemove) external onlyOwner{}
- Removes a base pool
| Parameters | type | Description |
|---|---|---|
poolId | uint | Id of the pool to remove |
forceRemove | bool | if true, removes all the liquidity available from the base pool |
Modify Pool Cap
function modifyPoolCap(uint256 poolId, uint256 assetCap) external onlyOwner
- modifies the allocation cap for a base pool
| Parameters | type | Description |
|---|---|---|
poolId | uint | Id of the pool to modify |
assetCap | uint | amount to set pool cap to |
Reallocation
function reallocate(ReallocateParams[] calldata withdraws, ReallocateParams[] calldata deposits) external
- Reallocate assets between underlying pools
| Parameters | type | Description |
|---|---|---|
withdraws | calldata | A list of poolIds, and the amount to withdraw from them |
deposits | calldata | list of poolIds, and the amount to deposit to them |
Lender Functions
Sentiment depositors can interact with Super Pools using functions for deposit and withdrawals. Super Pools are ERC4626 compliant, many of the utility functions should be familiar to most DeFi developers.
Deposit
function deposit(uint256 assets, address receiver) public nonReentrant returns (uint256 shares)
- Allows a user to deposit assets in the Super Pool
| Parameters | type | Description |
|---|---|---|
assets | uint | The amount of assets to deposit |
receiver | address | The address to receive the shares |
Withdraw
function withdraw(uint256 assets, address receiver, address owner) public nonReentrant returns (uint256 shares)
- Withdraw assets from Super Pool
| Parameters | type | Description |
|---|---|---|
assets | uint | The amount of assets to withdraw |
receiver | address | The address to receive the assets |
owner | address | The address to withdraw the assets from |
Redeem
function redeem(uint256 shares, address receiver, address owner) public nonReentrant returns (uint256 assets)
- An alternative withdraw function that uses shares instead of asset amounts
- This is good for accurate withdrawals. Since interest accrues per block, the regular withdrawal function is susceptible to leaving dust
| Parameters | type | Description |
|---|---|---|
shares | uint | The amount of shares to redeem |
receiver | address | The address to receive the assets |
owner | address | The address to redeem the shares from |